<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>vue 03</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
    <div id="app">{{a}}</div>
    <script text="text/javascript">
        var data = { a: 1 };
        var vm = new Vue({
            el: '#app',
            data: data
        });
        vm.$watch("a", (newValue, oldValue) => {
            console.log(newValue, oldValue);
        });
        setTimeout(() => {
            // data.a = "test";
            // vm.a = "vm set a"
            vm.$data.a = " vm.$data.a set"
        }, 3000);
    </script>
</body>